const { request } = require('./request')

function getPPP(data) {
  return request({
    url: '/ppp',
    method: 'GET',
    data
  })
}

function postNewsData(data) {
  data.key = 'a8b252e1957ebb55e705ced204a6e83e'
  return request({
    method: 'GET',
    data
  }, { url: 'http://api.tianapi.com/topnews/index' })
}

function getSecretList(data) {
  return request({
    url: '/secret/all',
    method: 'GET',
    data
  })
}

function getWeatherData(data) {
  const {province,city,county} = data
  return request({
    method: 'GET',
    data:{
      source:'xw',
      weather_type:'forecast_1h|forecast_24h|index|alarm|limit|tips',
      province,
      city,
      county
    }
  },{
    url: 'https://wis.qq.com/weather/common',
  })
}

module.exports = {
  getPPP,
  postNewsData,
  getSecretList,
  getWeatherData
}